<template>
  <div id="lb">
      <Header/>  
      <Footer/>
      <div id="lb-1">
          <div id="lb-header">
              <ul>
                  <li>
                      <a href="">综合排序</a>
                  </li>
                  <li>
                      <a href="">新上架</a>
                  </li>
                  <li>
                      <a href="">销量</a>
                  </li>
                  <li>
                      <a href="">筛选</a>
                  </li>
              </ul>
          </div>
          <div id="lb-2" @click="fun()">
              <ul>
                  <li v-for="(v,i) in arr" :key="i">
                      <div id="box1">
                          <img :src="v.goods_image_url">
                      </div>
                        <a href="#">{{v.goods_name}}</a>
                        <p>入门优选</p>
                        <div id="box2">
                            <span>￥{{v.goods_price}}</span>
                            <span>销量:{{v.goods_salenum}}</span>
                        </div>
                  </li>
              </ul>
          </div>
      </div>
  </div>
</template>

<script>
import Header from "./header.vue"
import Footer from "./footer.vue"
export default {
    methods:{
        fun(){
            // 编程式导航   
            this.$router.push("/xiangqing")
        },
    },
    components:{
        Header,
        Footer
    },
    computed:{
        arr(){
            return this.$store.state.lb.arr;
        }
    },
    created(){
        this.$store.dispatch("Lbe","/data/usera")
    }
}
</script>

<style>
#lb-1{
    width: 100%;
    height: 100%;
    background-color: gainsboro;
    margin: .45rem 0;
}
#lb-header{
    width: 100%;
    height: .5rem;
    background-color: white;
}
#lb-header ul{
    width: 100%;
    display: flex;
}
#lb-header ul li{
    height: .5rem;
    line-height: .5rem;
    font-size: .14rem;
    width: 25%;
    text-align: center;
}
#lb-2{
    width: 100%;
    padding: .1rem;
   
}
#lb-2 ul{
    width: 100%;
     display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}
#lb-2 ul li{
    width: 48%;
    display: flex;
    flex-wrap: wrap;
    background-color:#fff;
    margin-bottom: .16rem;
    border-radius: .05rem;
    overflow: hidden;
}
#lb-2 ul li #box1 img{
    width: 100%;
}
#lb-2 ul li p{
    font-size: 10px;
    padding: 1px 3px;
    border-radius: 3px;
    border: 1px solid #c9141c;
    margin: .1rem 0;
    display: inline-block;
    color: #c9141c;
}

#lb-2 ul li #box2{
    display: flex;
    justify-content: space-between;
    width: 100%;
}
#lb-2 ul li #box2 span:nth-of-type(1){
    color: red;
}
#lb-2 ul li #box2 span:nth-of-type(2){
    font-size: .12rem;
}
</style>